function ModelCreator(Model) {
  class ModelExtend extends Model {
    constructor(...args) {
      super(...args)
    }

    async fields_get(allfields, kwargs = {}) {
      const res = await super.fields_get(allfields, kwargs)

      // console.log(
      //   'todo: account.analytic.line fields_get',
      //   allfields,
      //   kwargs,
      //   res
      // )

      if (!('account_id' in res)) {
        return res
      }

      const { account_id } = res

      if (!('domain' in account_id)) {
        return res
      }

      const domain1 = res.account_id.domain

      console.log('todo: account.analytic.line fields_get', domain1)
      const domain = [['plan_id', 'child_of', 1]]

      const res2 = { ...res, account_id: { ...account_id, domain } }

      return res2
    }
  }

  return ModelExtend
}

const metadata = {}

const AddonsModels = {
  'account.analytic.line': {
    ModelCreator,
    metadata
  }
}

export default AddonsModels
